import './style.css'
import DuoMapUni from './DuoMapUni'
import configs from './configs'
import getUrl from './DuoMapUni/utils/getURL'

document.querySelector('#app').innerHTML = `
  <div id='map'>
  </div>
`
const duomap = new DuoMapUni(configs);
const { changeBaseMap, createVectorLayer, createLineStyle, createPointFeature, createIconStyle } = duomap;

duomap.init((res) => {
  // changeBaseMap(1);
  duomap.onMapClick((e) => {
    console.log(e);
    // console.log(duomap.getLayerByID('vectorLayer'));
  })
  duomap.addLayer(createVectorLayer({
    source: {
      features: [createPointFeature([103.993166, 30.754256])],
    },
    layer: {
      style: ()=>{
        let zoom = duomap.getZoom();
        console.log(zoom);
        return duomap.createIconStyle(getUrl('./static/logo.png'),(1-zoom)/10)
      },
      id: 'vectorLayer'
    }
    
  }, (layer) => {
    duomap.setLayerProps(layer, {

      zIndex: 4
    })
    return layer;
  }));

}, (data) => {
  console.log(data);
});

